import { BasicColumn, FormSchema } from '@/components/Table';
import { h, ref } from 'vue';
import { Tag } from 'ant-design-vue';
import { departmentTreeList } from '@/api/sys/msUser';
import { ywGroupSelectList } from '@/api/heng/ywManage';

import { useUserStore } from '@/store/modules/user';
const userStore = useUserStore();

//表格列名
export const columns: BasicColumn[] = [
  {
    title: '部门名称',
    dataIndex: 'deptName',
    width: 130,
  },
  {
    title: '货币类型',
    dataIndex: 'type',
    width: 150,
  },

  {
    title: '抽成比例',
    dataIndex: 'commissionRate',
    format: (value) => `${value ? value + '%' : ''}`,
    width: 120,
  },
  {
    title: '起始金额',
    dataIndex: 'startPrice',
    width: 180,
  },
  {
    title: '结束金额',
    dataIndex: 'endPrice',
    width: 150,
  },

  {
    title: '创建时间',
    width: 180,
    dataIndex: 'createTime',
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'keyword',
    label: '搜索',
    component: 'Input',
    colProps: { span: 8 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'deptId',
    label: 'deptId',
    show: false,
  },
  {
    field: 'deptName',
    label: '部门名称',
    required: true,
    slot: 'deptName',
  },
  {
    field: 'type',
    label: '货币类型',
    component: 'Select',
    required: true,
    componentProps: {
      options: [
        { label: '人民币', value: '人民币' },
        { label: '美元', value: '美元' },
      ],
    },
  },
  {
    field: 'commissionRate',
    label: '抽成比例',
    component: 'InputNumber',
    required: true,
    suffix: '%',
    componentProps: {
      min: 0,
      max: 100,
    },
  },
  {
    field: 'startPrice',
    label: '开始金额',
    component: 'InputNumber',
  },
  {
    field: 'endPrice',
    label: '结束金额',
    component: 'InputNumber',
  },
];
